home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class PushbackInputStream extends FilterInputStream {
- protected int pushBack = -1;
-
- public PushbackInputStream(InputStream var1) {
- super(var1);
- }
-
- public int read() throws IOException {
- int var1 = this.pushBack;
- if (var1 != -1) {
- this.pushBack = -1;
- } else {
- var1 = super.in.read();
- }
-
- return var1;
- }
-
- public int read(byte[] var1, int var2, int var3) throws IOException {
- if (this.pushBack != -1) {
- if (var3 == 0) {
- return 0;
- } else {
- var1[var2] = (byte)this.pushBack;
- this.pushBack = -1;
- return 1;
- }
- } else {
- return super.in.read(var1, var2, var3);
- }
- }
-
- public void unread(int var1) throws IOException {
- if (this.pushBack != -1) {
- throw new IOException("Attempt to unread more than one character!");
- } else {
- this.pushBack = var1;
- }
- }
-
- public int available() throws IOException {
- return this.pushBack == -1 ? super.available() : super.available() + 1;
- }
-
- public boolean markSupported() {
- return false;
- }
- }
-